import request from "@/api/config";
import { AxiosPromise } from 'axios';
import {PORT} from "@/leadmall/api/config/servicePort";
import { LogVO, LogForm, LogQuery } from '@/leadmall/api/log/types';

/**
 * 查询操作记录列表
 * @param query
 * @returns {*}
 */

export const listLog = (query?: LogQuery): AxiosPromise<LogVO[]> => {
  return request({
    url: PORT +'/leadmall/log/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询操作记录详细
 * @param id
 */
export const getLog = (id: string | number): AxiosPromise<LogVO> => {
  return request({
    url: PORT +'/leadmall/log/' + id,
    method: 'get'
  });
};

/**
 * 新增操作记录
 * @param data
 */
export const addLog = (data: LogForm) => {
  return request({
    url: PORT +'/leadmall/log',
    method: 'post',
    data: data
  });
};

/**
 * 修改操作记录
 * @param data
 */
export const updateLog = (data: LogForm) => {
  return request({
    url: PORT +'/leadmall/log',
    method: 'put',
    data: data
  });
};

/**
 * 删除操作记录
 * @param id
 */
export const delLog = (id: string | number | Array<string | number>) => {
  return request({
    url: PORT +'/leadmall/log/' + id,
    method: 'delete'
  });
};
